﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;

namespace GameWP
{
    public class SettingScreen : GameScreen
    {
#region Properties
        private Texture2D _bgSetting;
        public Texture2D BgSetting
        {
            get { return _bgSetting; }
            set { _bgSetting = value; }
        }

        private SettingComponent _settingComponent;
#endregion

#region  Initilation
        public SettingScreen(Game game, MainGame mainGame, SpriteBatch spriteBatch, Texture2D bgAbout, SpriteFont menuFont, SpriteFont textFont)
            : base(game, mainGame, spriteBatch)
        {
            _game = game;
            _mainGame = mainGame;
            _spriteBatch = spriteBatch;
            _bgSetting = bgAbout;
            //Init Menucomponent
            _settingComponent = new SettingComponent(_game, menuFont, textFont, _spriteBatch);
            Components.Add(_settingComponent);
            //Event su kien click cua button item menu click
            for (int i = 0; i < _settingComponent.ListItemMenu.Count; i++)
            {
                _settingComponent.ListItemMenu[i].Selected += new Button.IsSelected(ItemMenu_Selected);
            }
        }      
#endregion

#region Methods
        void ItemMenu_Selected(int input)
        {
            _mainGame.ShowScreen(input);
        }
#endregion

#region Update & Draw
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            _spriteBatch.Begin();
            _spriteBatch.Draw(_bgSetting, Vector2.Zero, Color.White);
            base.Draw(gameTime);
            _spriteBatch.End();
        }
#endregion
    }
}
